#include <gtest/gtest.h>
#include "scheduler/force_success_scheduler.h"
#include "scheduler/sequence_scheduler.h"
#include "scheduler/fallback_scheduler.h"
#include "scheduler/scheduler_factory.h"
#include "task/task_factory.h"
#include "../sample/battery_level_check.h"
#include "../sample/navigation_task.h"

TEST(test_force_success_scheduler_sequence, test_force_success_scheduler)
{
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
    auto navigation = task::TaskFactory<NavigationTask>::createTask("navigation");

    auto force_success_scheduler = scheduler::SchedulerFactory<scheduler::ForceSuccessScheduler>::createScheduler("force_success_scheduler");
    force_success_scheduler->setTask(battery_level_check);

    auto sequence_scheduler = scheduler::SchedulerFactory<scheduler::SequenceScheduler>::createScheduler("sequence_scheduler");
    sequence_scheduler->appendScheduler(force_success_scheduler);
    sequence_scheduler->appendTask(navigation);

    sequence_scheduler->run();

    EASE_INFO("done");
}

TEST(test_force_success_scheduler_fallback, test_force_success_scheduler)
{
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
    auto navigation = task::TaskFactory<NavigationTask>::createTask("navigation");

    auto force_success_scheduler = scheduler::SchedulerFactory<scheduler::ForceSuccessScheduler>::createScheduler("force_success_scheduler");
    force_success_scheduler->setTask(battery_level_check);

    auto fallback_scheduler = scheduler::SchedulerFactory<scheduler::FallbackScheduler>::createScheduler("fallback_scheduler");
    fallback_scheduler->appendScheduler(force_success_scheduler);
    fallback_scheduler->appendTask(navigation);

    fallback_scheduler->run();

    EASE_INFO("done");
}
